import request from '@/utils/request'
// 库存列表
export function getStockList({ condition, page, kind } = {}) {
  return request({
    url: '/api/back/shop/commodityRecord',
    method: 'get',
    params: { type: 'list', status: 2, per_page: 12, page, condition, kind }
  })
}
// 库存增加
export function addStock({ id, number, message }) {
  return request({
    url: '/api/back/shop/commodityRecord',
    method: 'post',
    data: { id, number, message },
    params: { type: 'add', status: 2 }
  })
}
// 库存减少
export function reduceStock({ id, number, message }) {
  return request({
    url: '/api/back/shop/commodityRecord',
    method: 'post',
    data: { id, number, message },
    params: { type: 'minus', status: 2 }
  })
}
// 库存记录
export function recordStockList({ page, id, start_time, end_time }) {
  return request({
    url: '/api/back/shop/commodityRecord',
    method: 'get',
    params: { type: 'record', page, id, start_time, end_time }
  })
}
// 业务员进货审批
export function getEnterList({ page, status, condition }) {
  return request({
    url: '/api/back/offline/clerk',
    method: 'get',
    params: { handle: 'stock', type: 'apply', page, status, condition, per_page: 11 }
  })
}
// 进货/退货申请同意
export function applyAgree(id) {
  return request({
    url: '/api/back/offline/clerk',
    method: 'post',
    data: { id },
    params: { type: 'applyPass' }

  })
}
// 进货/退货申请同意
export function applyRefuse(id, remark) {
  return request({
    url: '/api/back/offline/clerk',
    method: 'post',
    data: { id, remark },
    params: { type: 'refuse' }
  })
}
// 业务员退货审批
export function getBackList({ page, status, condition }) {
  return request({
    url: '/api/back/offline/clerk',
    method: 'get',
    params: { type: 'apply', handle: 'return', page, status, condition }
  })
}
// 删除
export function deleteStockItem(id) {
  return request({
    url: '/api/back/offline/clerk',
    method: 'post',
    params: { type: 'delete' },
    data: { id }
  })
}
